 class ListNode {
     int val;
     ListNode next;
     ListNode(int x) {
         val = x;
         next = null;
     }
 }
/**
 * https://leetcode-cn.com/problems/linked-list-cycle/
 */
public class Solution{
  public boolean hasCycle(ListNode head) {
        ListNode fast = head,low = head;
        while(fast != null && fast.next != null){
            fast = fast.next.next;
            low = low.next;
            if(fast == low) return true;
        }
        return false;
  }
}